import request from '@/utils/request'

// 查询出库领料开单作业列表
export function listPicking(query) {
  return request({
    url: '/output/picking/list',
    method: 'get',
    params: query,
  })
}

// 查询出库领料开单作业详细
export function getPicking(clmId) {
  return request({
    url: '/output/picking/' + clmId,
    method: 'get',
  })
}

// 新增出库领料开单作业
export function addPicking(data) {
  return request({
    url: '/output/picking',
    method: 'post',
    data: data,
  })
}

// 修改出库领料开单作业
export function updatePicking(data) {
  return request({
    url: '/output/picking',
    method: 'put',
    data: data,
  })
}

// 删除出库领料开单作业
export function delPicking(clmId) {
  return request({
    url: '/output/picking/' + clmId,
    method: 'delete',
  })
}

// 导出出库领料开单作业
export function exportPicking(query) {
  return request({
    url: '/output/picking/export',
    method: 'get',
    params: query,
  })
}

// 查询字表数据
export function searchCk(query) {
  return request({
    url: '/output/picking/getAddCld',
    method: 'get',
    params: query,
  })
}
// 查询字表数据
export function getAddCldByJZ(query) {
  return request({
    url: '/output/picking/getAddCldByJZ',
    method: 'get',
    params: query,
  })
}
// 查询字表数据
export function exportAddCldNonPlan(query) {
  return request({
    url: '/output/picking/exportAddCldNonPlan',
    method: 'get',
    params: query,
  })
}

/** 提交 */
export function submitCkMx(clmDjbh) {
  return request({
    url: '/output/picking/submitClm/' + clmDjbh,
    method: 'put',
  })
}
//子表确认
export function ckSumitChild(data) {
  return request({
    url: '/output/picking/addCld',
    method: 'post',
    data: data,
  })
}

// 导出领料统计
export function exportPickingTotal(order) {
  return request({
    url: '/output/picking/exportPickingTotal/' + order,
    method: 'get',
  })
}

// 出货明细列表
export function listckMxDet(chdDjbh) {
  return request({
    url: '/output/picking/getDetailsData/' + chdDjbh,
    method: 'get',
    headers: { pendingKey: '/output/picking/getDetailsData/' },
  })
}
// /hd-api/output/picking/deleteCld/{cldId}
export function delCkMxDet(cldId) {
  return request({
    url: '/output/picking/deleteCld/' + cldId,
    method: 'delete',
  })
}
/** 撤回-开单 */
export function clmMstrBack(order, reson) {
  return request({
    url: '/output/picking/rollbackClm/' + order + '/' + reson,
    method: 'put',
  })
}
/** 审核 */
export function clmMstrCheck(clmDjbh) {
  return request({
    url: '/output/picking/checkClm/' + clmDjbh,
    method: 'put',
  })
}
/** 过账 */
export function clmPost(order) {
  return request({
    url: '/output/picking/clmPost/' + order,
    method: 'put',
  })
}
/** 一键检验 */
export function oneClickDeliveryCk(order) {
  return request({
    url: '/output/picking/OneClickDelivery/' + order,
    method: 'put',
  })
}
/** 出库确认 */
export function confirmScCk(order, wldm) {
  return request({
    url: '/output/picking/OneClickDelivery/' + order + '/' + wldm,
    method: 'put',
  })
}

// 产品领用Bom
export function getProductMod(modZzdh, itmCkdm) {
  return request({
    url: `/output/picking/getMod/${modZzdh}/${itmCkdm}`,
    method: 'get',
  })
}

export function getNeedCld(query) {
  return request({
    url: '/output/picking/getNeedCld',
    method: 'get',
    params: query,
  })
}

//子表确认
export function saveBatchClm(data) {
  return request({
    url: '/output/picking/saveBatchClm',
    method: 'post',
    data: data,
  })
}
